<?php
// +----------------------------------------------------------------------
// | 版权所有 2010~2023 重庆小奇迹科技有限公司
// +----------------------------------------------------------------------
// | 官方网站: http://www.szn.com
// +----------------------------------------------------------------------
namespace app\controller;

use app\Controller;
use app\service\Slide;

/*
 * 验证码控制器
 * @author Mateng <Index.php>
 */
class Captcha extends Controller
{
    /**
     * 文本验证码
     *
     * @return void
     */
    public function text(){
        $resp = Captcha::create();
        return json([
            'url' => 'data:image/png;base64,' . base64_encode($resp->getData())
        ]);
    }
    /**
     * 滑块验证码
     *
     * @return void
     */
    public function slide(){
        $slide = new Slide();
        $imgName = $slide->make($this->request->uid);
        return json($this->request->domain . '/upload/slide/' . $imgName);
    }
}
